<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jsTree test</title>
<!-- 2 load the theme CSS file -->
<%@include file="/WEB-INF/jsp/admin/public/cssHeader.jsp"%>
<%@include file="/WEB-INF/jsp/admin/public/jsBottom.jsp"%>
</head>
<body>
	<!-- 3 setup a container element -->
	<div id="jstree">
	</div>

	<button id="sure">确定</button>

	<script>
		$(function() {
			// 6 create an instance when the DOM is ready
// 			$('#jstree').jstree({
// 				"plugins" : [ "checkbox" ],
// 			});

			// 7 bind to events triggered on the tree
			$('#jstree').jstree({'plugins':["checkbox"], 'core' : {
				'data' : [
					{	
						"id":1,
						"text" : "Same but with checkboxes",
						"children" : [
							{ "id":2,"text" : "initially selected","state" : { "selected" : true }},
							{ "id":3,"text" : "custom icon URL", "icon" : "//jstree.com/tree-icon.png","state" : { "selected" : true }},
							{ "id":4,"text" : "initially open", "children" : [ "Another node" ] },
							{ "id":5,"text" : "custom icon class", "icon" : "glyphicon glyphicon-leaf" }
						]
						
					}
				]
			}});
		});

		$("#sure").click(function() {
			var nodes = $("#jstree").jstree("get_checked"); //使用get_checked方法 
			$.each(nodes, function(i, n) {
				alert(n);
			});
		});
	</script>
</body>
</html>

